var fromModule='';
//隐藏显示树状结构
$(".menuBtn i").on('click', function() {
    var btn = $(this);
    if (btn.hasClass('layui-icon-shrink-right')) {
        $(".west").animate({ width: '114px',background:pellucidityTen });
        $(".layui-body").animate({ left: '0' });
        $(".layui-footer").animate({ left: '0' });
    } else {
        var widthV = '310px', leftV = '310px';
        if(fromModule == "organization"){
            widthV = '310px', leftV = '310px';
        }
        $(".west").animate({ width: widthV });
        $(".layui-body").animate({ left: leftV });
        $(".layui-footer").animate({ left: leftV });
    }
    $(".layui-side-scroll").animate({ width: 'toggle' });
    $(".layui-expand-west").animate({ width: 'toggle' });
})

window.onload = function(){//绑定拖拽事件
    $("#panel").css({cursor: "pointer"})
    var oDiv = document.getElementById("panel");
    var disX = 0;
    var disY = 0;
    if (!oDiv) return
    oDiv.onmousedown = function(ev){
        var oEvent = ev||event;
        disX = oEvent.clientX - oDiv.offsetLeft;
        disY = oEvent.clientY - oDiv.offsetTop;
        document.onmousemove = function(ev){
            var oEvent = ev || event;
            var t = oEvent.clientY - disY;//块的y位置
            if(t <0)
            {
                t = 0;
            }else if(t>document.documentElement.clientHeight - oDiv.offsetHeight)
            {
                t = document.documentElement.clientHeight - oDiv.offsetHeight;
            }
            oDiv.style.top = t +"px";
        };
        document.onmouseup = function(){
            document.onmousemove = null;
            document.onmouseup = null;
        }
        return false;//阻止火狐bug ff下拖拽空div会出现重影
    }
}
//获取树数据
function getTree(url){
    var data = [];
    $.ajax({
        url: url,    //后台数据请求地址
        data: {id: 11},        //id为加载当前角色的权限菜单，为角色id
        type: "post",
        async:false,
        success: function(resut){
            data = resut;
        }
    });
    return data;
}